package com.software.seakdream.service;

import com.software.seakdream.entity.ClockInfo;
import com.software.seakdream.repository.ClockInfoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class ClockInfoServiceImpl implements ClockInfoService {

    @Autowired
    private ClockInfoRepository clockInfoRepository;

    @Override
    public List<ClockInfo> findClockInfo(String userId) {
        return clockInfoRepository.findClockInfo(userId);
    }

    @Override
    public int createClockInfo(ClockInfo clockInfo) {
        clockInfo.setClockId(UUID.randomUUID().toString());
        return clockInfoRepository.save(clockInfo);
    }

    @Override
    public int editClock(ClockInfo clockInfo) {
        return clockInfoRepository.editClock(clockInfo);
    }

    @Override
    public int deleteClock(String clockId) {
        return clockInfoRepository.deleteClockById(clockId);
    }

}
